import Home from '../components/home/Home.vue';

export default {
  fillMenuRouter(meunlist:object[]) {
    // 路由模版
    let currMenu = [
      {
        path: '/',
        component: Home,
        children: [],
      },
    ];
    // 菜单递归
    function Menu(data:any) {
      console.log(data);
      data.forEach((item:any) => {
        if (item.children) {
          Menu(item.children);
        } else {
          item.component = () => import(`../view${ item.path }.vue`);
          //   item.path = item.path;
          currMenu[0].children.push(item);
        }
      });
    }
    console.log(meunlist);
    Menu(meunlist);
    console.log(currMenu);
    return currMenu;
  },
};